﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DataBinding.aspx.cs" Inherits="DataBinding" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DataList ID="DataList1" runat="server" OnEditCommand="DataList1_EditCommand" OnUpdateCommand="DataList1_UpdateCommand">
            <EditItemTemplate>
                <asp:LinkButton ID="Button1" runat="server" Text='<%# "Update_" + Container.DataItem.ToString() %>' CommandName="update" />
                <asp:LinkButton ID="Button2" runat="server" Text='<%# "Cancel_" + Container.DataItem.ToString() %>' CommandName="cancel" />
                <asp:TextBox ID="TextBox1" runat="server" Text="<%# Container.DataItem.ToString() %>"></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:LinkButton ID="Button1" runat="server" Text='<%# "Select_" + Container.DataItem.ToString() %>' CommandName="select" />
                <asp:LinkButton ID="Button2" runat="server" Text='<%# "Edit_" + Container.DataItem.ToString() %>' CommandName="edit" />
                <asp:TextBox ID="TextBox1" runat="server" Text="<%# Container.DataItem.ToString() %>"></asp:TextBox>
            </ItemTemplate>
            <SelectedItemStyle BackColor="#9999FF" />
            <SelectedItemTemplate>
                <asp:LinkButton ID="Button1" runat="server" Text='<%# "Select_" + Container.DataItem.ToString() %>' CommandName="select" />
                <asp:LinkButton ID="Button2" runat="server" Text='<%# "Edit_" + Container.DataItem.ToString() %>' CommandName="edit" />
                <asp:TextBox ID="TextBox1" runat="server" Text="<%# Container.DataItem.ToString() %>"></asp:TextBox>
            </SelectedItemTemplate>
        </asp:DataList>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" AutoGenerateSelectButton="True" EnableModelValidation="True">
            <Columns>
                <asp:CommandField ShowCancelButton="False" ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" ShowSelectButton="True" />
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>
